package interval

import (
	
	

	
	
)

// Option represents an option that can be used to configure an interval.
type Option func(interval *Interval)

// ValuesList represent a list of options for an interval variable.
type ValuesList []string

// Interval represents a "interval" templated variable.
type Interval struct {
	Builder sdk.TemplateVar
}

// New creates a new "interval" templated variable.
func ( string,  ...Option) *Interval {
	 := &Interval{Builder: sdk.TemplateVar{
		Name:    ,
		Label:   ,
		Type:    "interval",
		Options: []sdk.Option{},
	}}

	for ,  := range  {
		()
	}

	return 
}

// Values sets the possible values for the variable.
func ( ValuesList) Option {
	return func( *Interval) {
		sort.SliceStable(, func(,  int) bool {
			,  := model.ParseDuration([])
			,  := model.ParseDuration([])
			return  < 
		})

		for ,  := range  {
			.Builder.Options = append(.Builder.Options, sdk.Option{
				Text:  ,
				Value: ,
			})
		}

		.Builder.Query = strings.Join(, ",")
	}
}

// Default sets the default value of the variable.
func ( string) Option {
	return func( *Interval) {
		.Builder.Current = sdk.Current{
			Text:  &sdk.StringSliceString{Value: []string{}, Valid: true},
			Value: ,
		}
	}
}

// Label sets the label of the variable.
func ( string) Option {
	return func( *Interval) {
		.Builder.Label = 
	}
}

// HideLabel ensures that this variable's label will not be displayed.
func () Option {
	return func( *Interval) {
		.Builder.Hide = 1
	}
}

// Hide ensures that the variable will not be displayed.
func () Option {
	return func( *Interval) {
		.Builder.Hide = 2
	}
}